﻿/**
 * @file guild_service_welfare_context.h
 * @date 2021/06/08 10:05
 *
 * @author harrybao (harrybao@123u.com)
 *
 * @brief 公会福利服务上下文
 *
 * @version v1.0.0
 *
 * @copyright Copyright © 2021 All Rights Reserved 上海欢乐互娱网络科技有限公司
 *
 * @par history:
 * <table>
 * <tr><th>Date                     <th>Version     <th>Author <th>Description
 * <tr><td>2021/06/08 14:31         <td>1.0.0       <td>harrybao
 * <td>创建初始版本
 * </table>
 */

#pragma once

#include <memory>
#include "rpc_defines.h"


struct SendGuildRedEnvelopeArg;
struct SendGuildRedEnvelopeRes;
struct GrabGuildRedEnvelopeArg;
struct GrabGuildRedEnvelopeRes;
struct LoginArg;
struct LoginRes;
struct LogoutNtfData;
struct SetGuildAuctionOfferArg;
struct SetGuildAuctionOfferRes;
struct SetGuildAuctionAttentionArg;
struct SetGuildAuctionAttentionRes;
struct AddGuildRepositoryCellItemArg;
struct AddGuildRepositoryCellItemRes;
struct DelGuildRepositoryCellItemArg;
struct DelGuildRepositoryCellItemRes;
struct GetGuildWelfareAwardArg;
struct GetGuildWelfareAwardRes;

namespace kratos {
namespace service {
class ServiceContext;
}
}  // namespace kratos

namespace guild_service {

/**
 * @brief 公会福利服务上下文类
 *
 */
class GuildServiceWelfareContext {
  GuildServiceWelfareContext() = delete;
  GuildServiceWelfareContext(const GuildServiceWelfareContext &) = delete;
  GuildServiceWelfareContext(GuildServiceWelfareContext &&) = delete;
  const GuildServiceWelfareContext &operator=(
      const GuildServiceWelfareContext &) = delete;
  const GuildServiceWelfareContext &operator=(GuildServiceWelfareContext &&) =
      delete;

 public:
  /**
   * @brief 启动
   *
   * @param context 服务上下文
   * @return true 启动成功
   * @return false 启动失败
   */
  static bool Start(kratos::service::ServiceContext *context);

  /**
   * @brief 关闭
   *
   * @return true 关闭成功
   * @return false 关闭失败
   */
  static bool Stop();

  /**
   * @brief 初始化
   * @param context
   * @return 执行结果
   */
  static bool Init(kratos::service::ServiceContext *context);

  /**
   * @brief 未初始化
   * @return 执行结果
   */
  static bool Uninit();

  /**
   * @brief 更新
   *
   * @param ms 间隔（单位 毫秒 ）
   */
  static void Tick(time_t ms);

 public:
  /**
   * @brief 发公会红包
   * @param arg 发公会红包参数
   * @param res 发公会红包返回
   */
  static void SendGuildRedEnvelope(rpc::StubCallPtr call,
      const SendGuildRedEnvelopeArg &arg,
      std::shared_ptr<SendGuildRedEnvelopeRes> &res);

  /**
   * @brief 抢公会红包
   * @param arg 抢公会红包参数
   * @param res 抢公会红包返回
   */
  static void GrabGuildRedEnvelope(rpc::StubCallPtr call,
      const GrabGuildRedEnvelopeArg &arg,
      const std::shared_ptr<GrabGuildRedEnvelopeRes> &res);

  /**
   * @brief 登录
   *
   * @param call rpc请求
   * @param arg 登录参数
   * @param res 登录返回
   */
  static void Login(rpc::StubCallPtr call, const LoginArg &arg,
                    const std::shared_ptr<LoginRes> &res);

  /**
   * @brief 登出
   *
   * @param data 登出参数
   */
  static void Logout(rpc::StubCallPtr call, const LogoutNtfData &data);

  /**
   * @brief 设置拍卖道具出价
   *
   * @param arg 设置拍卖道具出价参数
   * @param res 设置拍卖道具出价返回
   */
  static void SetGuildAuctionOffer(rpc::StubCallPtr call,
      const SetGuildAuctionOfferArg &arg,
      const std::shared_ptr<SetGuildAuctionOfferRes> &res);

  /**
   * @brief 关注拍卖道具
   *
   * @param arg 关注拍卖道具参数
   * @param res 关注拍卖道具返回
   */
  static void SetGuildAuctionAttention(rpc::StubCallPtr call,
      const SetGuildAuctionAttentionArg &arg,
      const std::shared_ptr<SetGuildAuctionAttentionRes> &res);
  
  /**
   * @brief 添加仓库道具
   * 
   * @param arg 添加仓库道具参数
   * @param res 添加仓库道具返回
   */
  static void AddGuildRepositoryCellItem(rpc::StubCallPtr call,
      const AddGuildRepositoryCellItemArg &arg,
      std::shared_ptr<AddGuildRepositoryCellItemRes>
          &res);

  /**
   * @brief 删除仓库道具
   *
   * @param arg 删除仓库道具参数
   * @param res 删除仓库道具返回
   */
  static void DelGuildRepositoryCellItem(rpc::StubCallPtr call,
      const DelGuildRepositoryCellItemArg &arg,
      std::shared_ptr<DelGuildRepositoryCellItemRes> &res);

  /**
   * @brief 获取公会福利奖励
   * 
   * @param arg 获取公会福利奖励参数
   * @param res 获取公会福利奖励返回
   */
  static void GetGuildWelfareAward(rpc::StubCallPtr call,
      const GetGuildWelfareAwardArg &arg,
      std::shared_ptr<GetGuildWelfareAwardRes> &res);
};

}  // namespace guild_service